Ext.define('IHC.controller.ihc.cadastros.IHC001DetailFormController', {
    extend : 'Ext.app.Controller',
    
    requires : [
        'IHC.model.Atividade', 
        'IHC.store.ihc.cadastros.IHC001Atividade', 
        'IHC.view.ihc.cadastros.IHC001DetailFormWindow'
    ],
    
    views : [
        'IHC.view.ihc.cadastros.IHC001DetailFormWindow'
    ],
    
    stores : [
        'IHC.store.ihc.cadastros.IHC001Atividade'
    ],
    
    refs : [{
        ref : 'hintToolbar',
        selector : '#ihc001-detail-hint-toolbar'
    }, {
        ref : 'windowRef',
        selector : '#ihc001-detail-window'
    }, {
        ref : 'formRef',
        selector : '#ihc001-detail-form'
    }],
    
    mixins : [
        'InsoftExtUi.ux.mixins.controller.CrudDetailFormMixin'
    ],
    
    init : function() {
        var me = this;
        me.initController('IHC.store.ihc.cadastros.IHC001Atividade');
    },
    
    actionIndex : function(mode, record) {
        var me = this, window = me.createWindow();
        mode = mode || 'I';
        
        if (mode === 'I') {
            record = Ext.create('IHC.model.Atividade');
        }
        
        me.openWindow({
            window : window,
            mode : mode,
            record : record
        });
    },
    
    setExtraValues : function(form, record) {
        var me = this;
        record.set('projeto', {id : me.masterRecord.get('id')});
    }
});
